//package com.zmn.plat.admin.config;
//
//import com.zmn.common.utils.string.StringUtil;
//import org.apache.curator.shaded.com.google.common.collect.Maps;
//import org.springframework.boot.context.config.ConfigFileApplicationListener;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.env.Environment;
//import org.thymeleaf.spring5.view.ThymeleafViewResolver;
//
//import javax.annotation.Resource;
//import java.util.Map;
//
///**
// * @author liuhaichuan
// * @version v1.0
// * @since 2019/11/26 9:33
// **/
//@Configuration
//public class ThymeleafConfig {
//
//    @Resource
//    private Environment env;
//
//    /**
//     * 设置Thymeleaf全局变量
//     * @param thymeleafViewResolver
//     */
//    @Resource
//    private void configureThymeleafStaticVars(ThymeleafViewResolver thymeleafViewResolver) {
//        if (thymeleafViewResolver != null) {
//            String activeProfile = env.getProperty(ConfigFileApplicationListener.ACTIVE_PROFILES_PROPERTY);
//            if (StringUtil.isBlank(activeProfile)) {
//                activeProfile = "prod";
//            }
//            Map<String, Object> vars = Maps.newHashMap();
//            switch (activeProfile) {
//                case "local":
//                    vars.put("ZMN_EVN", "http://local-");
//                    break;
//                case "dev":
//                    vars.put("ZMN_EVN", "http://dev-");
//                    break;
//                case "test":
//                    vars.put("ZMN_EVN", "https://test-");
//                    break;
//                case "prod":
//                    vars.put("ZMN_EVN", "https://");
//                    break;
//            }
//            thymeleafViewResolver.setStaticVariables(vars);
//        }
//    }
//}
